define('MONITOR_LAST_VIEWED_FILE_INTERVAL',2000); // Interval (ms) for update of last viewed file thumnail (single history)
define('STATS_MAX_THUMBNAIL_WIDTH',160); // Left panel thumbnail max width, file info thumbnail max width
define('STATS_MAX_THUMBNAIL_HEIGHT',120); // Left panel thumbnail max height, file info thumbnail max height
$_ENV['colorPath']=array(array(150,100,160),array(250,100,250),array(250,125,0),array(50,50,250),array(50,250,50),array(250,50,50),array(0,250,250),array(255,0,0),array(255,255,0)); // Color path used for graphs coloration (linear interpolation between dots)
/**
* @desc set interval and localhost condition on a request on connection and resAccess tables
$result=sqlite_array_query($db,"SELECT strftime('".$sqlStep."',ts,'unixepoch') AS dte,Count(ip) AS cnt, accountId FROM baseView GROUP BY strftime('".$sqlStep."',baseView.ts,'unixepoch'),accountId",SQLITE_ASSOC);
$accounts=sqlite_array_query($db,"SELECT id,name FROM account",SQLITE_ASSOC);
$query='SELECT id,resourceId,content,ts FROM contentAccess WHERE connectionId = '.sqlite_escape_string($_POST['data2']).' AND content!="" ORDER BY ts DESC';
$res=sqlite_array_query($query,$db,SQLITE_ASSOC);
// If not any content viewed, set lastViewedContentId to 0 (!=-1) so list will be updated
$result=sqlite_array_query($db,'SELECT baseView.id as id, baseView.ip as ip, baseView.pseudo as pseudo, baseView.ts as ts, baseView.accountId as accountId, baseView.totalDuration as totalDuration, baseView.resourceId as resourceId, contentAccess.id AS contentId, contentAccess.content AS content FROM baseView LEFT OUTER JOIN contentAccess ON baseView.id=contentAccess.connectionId AND baseView.resourceId=contentAccess.resourceId ORDER BY baseView.id DESC, baseView.resourceId ASC, contentAccess.ts DESC',SQLITE_ASSOC);
$fullHistory=true;
}
// Else, show only basic info
else{
$result=sqlite_array_query($db,'SELECT * FROM baseView GROUP BY ip ORDER BY id DESC',SQLITE_ASSOC);
$fullHistory=false;
}
$currentId=false;
$currentResourceId=false;
$hasContent=false;
$firstConnection=true;
foreach ($result as $k=>$record){
// New connection
if($record['id']!=$currentId){
if($hasContent!==false) echo "</div>\n"; // Close content list
if($currentResourceId!==false) echo "</div>\n"; // Close resource
if($currentId!==false) {echo '</div></div><br>'; flush();} // Close connection
$result=sqlite_array_query($db,'SELECT baseView.id as id, baseView.ip as ip, baseView.pseudo as pseudo, baseView.ts as ts, baseView.accountId as accountId, baseView.resourceId as resourceId, contentAccess.id AS contentId, contentAccess.content AS content, contentAccess.ts as contentTs FROM baseView LEFT OUTER JOIN contentAccess ON baseView.id=contentAccess.connectionId AND baseView.resourceId=contentAccess.resourceId ORDER BY contentTs DESC',SQLITE_ASSOC);
$fullHistory=true;
}
// Else, show only basic info
else{
$result=sqlite_array_query($db,'SELECT * FROM baseView GROUP BY ip ORDER BY id DESC',SQLITE_ASSOC);
echo '<div class="frame3" style="position:relative;height:342px;width:392px;margin:0.5em;left:5px;margin-left:0px">'; // (remove arbitrary 8px for padding + WA for left margin)